Points, Lines, and Planes

Steven Dutch, Professor Emeritus, Natural and Applied Sciences,University of Wisconsin - Green Bay


Points, lines, and planes crop up in geology wheneverspatial relationships are concerned. This section is concernedmostly with providing formulas for reference. The formulas arewritten wherever practical in computer format, though manyformulas also lend themselves to matrix representation and theseformulas are also presented.

 

Points in the Plane

Distance between two points (X1,Y1) and (X2,Y2) D = √((X2-X1)*(X2-X1) + (Y2-Y1)*(Y2-Y1))

Midpoint of the line joining (X1,Y1) and (X2,Y2)
    X = (X2 + X1)/2
    Y = (Y1 + Y2)/2

Point dividing (X1,Y1) and (X2,Y2) in the ratio R/S
    X = (R*X2 + S*X1)/(R + S)
    Y = (R*Y2 + S*Y1)/(R + S)
Point lies R/S of the way from (X1,Y1) to (X2,Y2)

Slope of the line joining (X1,Y1) and (X2,Y2) M = (Y2 - Y1)/(X2 - X1)

Test for collinearity of three points (X1,Y1),(X2,Y2), and (X3,Y3)

|X1  Y1  1|        |X2  Y2  1|  = 0              |X3  Y3  1|
or  X2*Y3 - X3*Y2 + X3*Y1 - X1*Y3 + X1*Y2 - X2*Y1 = 0

Area of triangle bounded by three points (X1,Y1),(X2,Y2),(X3,Y3)

                     |X1  Y1  1|            A = (1/2) |X2  Y2  1|                            |X3  Y3  1|  

or A = (X2*Y3 - X3*Y2 + X3*Y1 - X1*Y3 + X1*Y2 - X2*Y1)/2

We can see that the test for collinearity of three points is simply that the area of the enclosed triangle is zero.

Points in Three Dimensions

Distance between two points (X1,Y1,Z1) and (X2,Y2,Z2)
D = √((X2-X1)*(X2-X1) + (Y2-Y1)*(Y2-Y1) + (Z2-Z1)*(Z2-Z1))

Midpoint of the line joining (X1,Y1,Z1) and (X2,Y2,Z2)
X = (X2 + X1)/2
Y = (Y1 + Y2)/2
Z = (Z1 + Z2)/2

Point dividing (X1,Y1,Z1) and (X2,Y2,Z2) in the ratio R/S
X = (R*X2 + S*X1)/(R + S),
Y = (R*Y2 + S*Y1)/(R + S),
Z = (R*Z2 + S*Z1)/(R + S)
Point lies R/S of the way from (X1,Y1,Z1) to (X2,Y2,Z2)

Test for collinearity of three points (X1,Y1),(X2,Y2), and (X3,Y3): 
(X2 - X1) /(Y2 - Y1) = (Z2 - Z1)/ (X2 - X1) = (Y2 - Y1) / (Z2 - Z1)

Area of triangle bounded by three points (X1,Y1,Z1),(X2,Y2,Z2) and (X3,Y3,Z3):

               _______________________________________________              / |Y1  Z1  1| 2    |Z1  X1  1| 2    |X1  Y1  1| 2A =    (1/2) /  |Y2  Z2  1|    + |Z2  X2  1|    + |X2  Y2  1|            √   |Y3  Z3  1|      |Z3  X3  1|      |X3  Y3  1|

This formula, like many others we will encounter, is too complex to get on one program line. We can evaluate it using the following routine:

S = (Y2-Y1)*(Z3-Z1) - (Y3-Y1)*(Z2-Z1)
T = S*S
S = (Z2-Z1)*(X3-X1) - (Z3-Z1)*(X2-X1)
T = T + S*S
S = (X2-X1)*(Y3-Y1) - (X3-X1)*(Y2-Y1)
T = T + S*S
A = SQRT(T)/2

Four points, (X1,Y1,Z1),(X2,Y2,Z2),(X3,Y3,Z3) and (X4,Y4,Z4) are coplanar if and only if:

              :X1  Y1  Z1  1:             :X2  Y2  Z2  1: = 0             :X3  Y3  Z3  1:             :X4  Y4  Z4  1:     
or
(X1 - X2) * ((Y3 - Y2)*(Z4 - Z2) - (Y4 - Y2)*(Z3 - Z2)) +
(Y1 - Y2) * ((X4 - X2)*(Z3 - Z2) - (X3 - X2)*(Z4 - Z2)) +
(Z1 - Z2) * ((X3 - X2)*(Y4 - Y2) - (X4 - X2)*(Y3 - Y2)) = 0

By comparison with the following formula, we can see that this test amounts to seeing whether or not the tetrahedron defined by the four points has zero volume.

Volume of the tetrahedron bounded by four points (X1,Y1,Z1), (X2,Y2,Z2), (X3,Y3,Z3) and (X4,Y4,Z4)

                        :X1  Y1  Z1  1:                        :X2  Y2  Z2  1:             V = (1/6)  :X3  Y3  Z3  1:                        :X4  Y4  Z4  1: 
or V =
(X1 - X2) * ((Y3 - Y2)*(Z4 - Z2) - (Y4 - Y2)*(Z3 - Z2))/6 +
(Y1 - Y2) * ((X4 - X2)*(Z3 - Z2) - (X3 - X2)*(Z4 - Z2))/6 +
(Z1 - Z2) * ((X3 - X2)*(Y4 - Y2) - (X4 - X2)*(Y3 - Y2))/6

Lines in the Plane

General Form: A*X + B*Y + C = 0

Slope:
M = -A/b
Intercepts:
X = -C/a Y = -C/b
Point closest to origin:
X = A*C/√(A*A+B*B) Y = B*C/√(A*A+B*B)
Distance of line from origin
D = C/√(A*A+B*B)
Distance from line to an arbitrary point X0,Y0:
D = (A*X0 + B*Y0 + C) / √(A*A+B*B)
Closest point on the line to X0,Y0:

Normal Form:  X * COS(U) + Y * SIN(U) = P

Slope:
M = -TAN(U)
Intercepts:
X = -P/cOS(U) Y = -P/SIN(U)
Point closest to origin:
X = P * COS(U) Y = P * SIN(U)
Distance of line from origin
D = P
Distance from line to an arbitrary point X0,Y0:
D = (X0*COS(U) + Y0*SIN(U) - P)
Closest point on the line to X0,Y0:

Slope-Y-Intercept Form: Y = M * X + B

Slope:
M
Intercepts:
X = -B/m Y = B
Point Closest to origin
X = M/√(1 + M*M), Y = 1/√(1 + M*M)
Distance of line from origin
D = B/√(1 + M*M)
Distance from line to an arbitrary point X0,Y0:
D = (M*X0 - Y0 + B) / √(1 + M*M)
Closest point on the line to X0,Y0:

Intercept Form: X/a + Y/b = 1

 Slope: M = -B/a Intercepts: X = A Y = B Point closest to origin: X = B / √(A*A + B*B) Y = A / √(A*A + B*B) Distance of line from origin D = A*B/√(A*A + B*B) Distance from line to an arbitrary point X0,Y0: D = (A*B - A*X0 - B*Y0 ) / √(A*A+B*B)

Two-Point Form (Y-Y1)/(Y2-Y1) = (X-X1)/(X2-X1)

or, Y = X*(Y2-Y1)/(X2-X1) - X1*(Y2-Y1)/(X2-X1) + Y1 Slope: M = (Y2-Y1)/(X2-X1) Intercepts

Two Lines in the Plane

Angle between two lines of slopes M1 and M2 A = ATN((M2 - M1)/(1 + M1*M2)) Lines are parallel if M1=M2, perpendicular if M1*M2 = -1

Intersection of Two Lines in the Plane

General Form: A1*X + B1*Y + C1 =0, A2*X + B2*Y + C2 = 0

X = (B1*C2-C1*B2)/(A1*B2-A2*B1) Y = (C1*A2-A1*C2)/(A1*B2-A2*B1)

Normal Form: X*COS(U1)+Y*SIN(U1)=P1, X*COS(U2)+ Y*SIN(U2)=P2 X = (P1*SIN(U2)-P2*SIN(U1))/SIN(U2-U1) Y = (P2*COS(U1)-P1*COS(U2))/SIN(U2-U1)

Slope-Intercept Form: Y = M1*X + B1, Y = M2*X + B2 X = (B2-B1)/(M1-M2) Y = (B1*M2-M1*B2)/(M1-M2)

Intercept Form: X/a1+Y/b1+Z/c1=1, X/a2+Y/b2+Z/c2=1 X = A1*A2*(B1-B2)/(B1*A2-A1*B2) Y = B1*B2*(A1-A2)/(B1*A2-A1*B2)

Three Lines In The Plane

Three lines given by the equations A1*X + B1*Y + C1 =0, A2*X + B2*Y + C2 = 0 and A3*X + B3*Y + C3 = 0 meet at one point if and only if:

     |A1  B1  C1|           |A2  B2  C2| = 0            |A3  B3  C3|
or C1*(A2*B3 - A3*B2) + C2*(A3*B1 - A1*B3)+ C3*(A1*B2 - A2*B1) = 0

Lines in Three Dimensions

We can describe the orientation of a line in terms ofthree numbers, A, B, and C, called Direction Numbers. A lineparallel to the given line and passing through the origin willmake angles U, V and W with the X, Y and Z axes respectively. Theangles are given by:

The quantities cos(U), cos(V) and cos(W) are the Direction Cosines of the line. They are obviously proportional to A, B, and C and are related by the formula cos(U)*cos(U) + cos(V)*cos(V) + cos(W)*cos(W) = 1

Point-Direction Form

Given point (X1,Y1,Z1) and directions A,B,C

Equation: (X - X1)/a = (Y - Y1)/b = (Z - Z1)/c

Two-Point Form

Given points (X1,Y1,Z1) and (X2,Y2,Z2)

Equation: (X-X1)/(X2-X1) = (Y-Y1)/(Y2-Y1) = (Z-Z1)/(Z2-Z1)

Obviously, if we know two points on a line, the differences between their X, Y and Z coordinates are direction numbers.

The plane which perpendicularly bisects line segment (X1,Y1,Z1), (X2,Y2,Z2) is:

X*(X1-X2) + Y*(Y1-Y2) + Z*(Z1-Z2) = ((X1*X1-X2*X2) + (Y1*Y1-Y2*Y2) + (Z1*Z1-Z2*Z2))/2

Parametric Form

Given a point (X1,Y1,Z1) and directions A,B,C:

Equation: X = X1 + T*A; Y = Y1 + T*B; Z = Z1 + T*C

Probably the most useful form for generating points on an arbitrary line. Obviously, equal increments in T will result in equally-spaced points on the line.

General Form

Given the equations A1*X + B1*Y +C1*Z +D1 = 0 and A2*X + B2*Y + C2*Z + D2 = 0

The direction numbers of the line that satisfies both equations are B1*C2-C1*B2, C1*A2-A1*C2, A1*B2-B1*A2. This case is actually the case of two intersecting planes. Pick a convenient value for X, Y, or Z, solve for the other two coordinates to find a point on the line, then apply the point-direction or parametric forms.

Two or More Lines in Three Dimensions

Angle Between Two Lines

Given two lines with direction numbers (A1,B1,C1) and (A2,B2,C2), the angle between the two directions in space is given by:

This formula is independent of whether or not the directions are direction numbers or direction cosines. If (A1,B1,C1) and (A2,B2,C2) are direction cosines, D1 and D2 both equal 1 and we have

Parallel and Perpendicular Lines

Given two lines with direction numbers (A1,B1,C1) and (A2,B2,C2):

Two Intersecting Lines

The two lines with point-direction equations (X-X1)/a1 = (Y-Y1)/b1 = (Z-Z1)/c1 and (X-X2)/a2 = (Y-Y2)/b2 = (Z-Z2)/c2 intersect if and only if

     |X2-X1  Y2-Y1  Z2-Z1|             | A1     B1     C1  |  = 0          | A2     B2     C2  |  
or, (X2-X1)*(B1*C2-B2*C1) + (Y2-Y1)*(C1*A2-A1*C2) +(Z2-Z1)*(A1*B2-B1*A2) = 0

3-7d THREE COPLANAR LINES Three lines with directions (A1,B1,C1), (A2,B2,C2) and (A3,B3,C3) are parallel to a common plane if and only if :A1 B1 C1:

Planes

Just as we can use direction cosines to define a line, wecan also use them to define a plane, since the line normal to agiven plane has a unique orientation. In fact, this is one of themost useful ways to specify the orientation of a plane. Theangles U, V, and W are the angles the X, Y, and Z axes make withthe line normal to the plane and passing through the origin, or,in other words, the Direction Cosines of the line normal to theplane. These cosines are called Attitude Cosines when used tospecify the orientation of the plane. Multiplying attitudecosines by a common multiple yields a set of numbers calledDirection Numbers.

3-7a GENERAL FORM A*X + B*Y + C*Z + D = 0 Intercepts: X = -D/a Y = -D/b Z = -D/c Direction Numbers: A B C Direction cosines: A/√(A*A + B*B + C*C) , and so on Distance from origin: Closest point to origin:

3-7b INTERCEPT FORM X/a + Y/b + C/Z = 1 Intercepts: X = A Y = B Z = C Direction Numbers Direction Cosines Distance from origin: Closest point to origin:Using the reciprocals of the intercepts is a very useful formatfor storing the orientations of planes, because it only takesthree numbers to specify the position of a plane completely andthere are no singularities when a plane happens to be parallel toa coordinate axis. The only limitation on this format is that aplane must not pass through the origin. This limitation canusually be avoided by a suitable choice of coordinate axes or, insome cases, by letting planes pass arbitrarily close to theorigin but not exactly through it.

3-7c NORMAL FORM X*cos(U) + Y*cos(V) + Z*cos(W) = P Intercepts: X = P/cos(U) Y = P/cos(V) Z = P/cos(W) Distance of plane from origin: D = P Closest point to origin: X = P*cos(U) Y = P*cos(V) Z = P*cos(W) For applications where the principal interest is in angularrelationships (as in structural geology or crystallography), thisis probably the best way to specify planes. In many such cases wecan let the plane pass through the origin, in which case P=0.

3-7d POINT - NORMAL FORM Given the point on the plane (X1,Y1,Z1) and the direction numbers of the plane: Equation: A*(X - X1) + B*(Y - Y1) + C*(Z -Z1) = 0

3-7e PLANE THROUGH ONE POINT AND PARALLEL TO TWO LINES Given the point (X1,Y1,Z1) and two lines with directions A1,B1,C1 and A2,B2,C2:

     :(X - X1)  (Y - Y1)  (Z - Z1):     :   A1        B1        C1   :   = 0     :   A2        B2        C2   :   
or, X*((B1*C2)-(C1*B2)) + Y*((C1*A2)-(A1*C2) + Z*((A1*B2)-(B1*A2)) = X1*((B1*C2)-(C1*B2)) + Y1*((C1*A2)-(A1*C2) + Z1*((A1*B2)-(B1*A2))Two notes here. First of all, this form is geologically usefulbecause it is essentially the case of a plane whose strike anddip are known at a given point. The strike line is one of thegiven lines and the down-dip line the other. Second, this and thefollowing cases result in such complicated formulas that it ispointless to give additional formulas for intercepts and so on.Instead, the programmer should probably use a separate variablefor each coefficient and then treat the plane as one of thesimpler cases above.

3-7f PLANE THROUGH TWO POINTS AND PARALLEL TO A GIVEN LINEGiven the two points (X1,Y1,Z1) AND (X2,Y2,Z2) and the line withdirections A ,B ,C:

     :(X - X1)  (Y - Y1)  (Z - Z1) :     :(X2 - X1) (Y2 - Y1) (Z2 - Z1):  = 0     :   A         B         C     :   
or, X*((Y2-Y1)*C - (Z2-Z1)*B) + Y*((Z2-Z1)*A - (X2-X1)*C) + Z*((X2-X1)*B - (Y2-Y1)*A) = X1*((Y2-Y1)*C - (Z2-Z1)*B) + Y1*((Z2-Z1)*A - (X2-X1)*C) + Z1*((X2-X1)*B - (Y2-Y1)*A)This case is exactly like the preceding case if we recall thatthe differences between coordinates of two points on a line aredirection numbers for that line. We merely substituted (X2-X1)for A1, A for A2, and so on.

Three-Point Form

Given the three points (X1,Y1,Z1), (X2,Y2,Z2) and (X3,Y3,Z3):

    |X   Y   Z   1|            | X - X1   Y - Y1   Z - Z1|    |X1  Y1  Z1  1|    or      |X2 - X1  Y2 - Y1  Z2 - Z1| = 0    |X2  Y2  Z2  1|            |X3 - X1  Y3 - Y1  Z3 - Z1|    |X3  Y3  Z3  1|
or

X * ((Y2 - Y1)*(Z3 - Z1) - (Y3 - Y1)*(Z2 - Z1)) +
Y * ((X3 - X1)*(Z2 - Z1) - (X2 - X1)*(Z3 - Z1)) +
Z * ((X2 - X1)*(Y3 - Y1) - (X3 - X1)*(Y2 - Y1)) =

X1 * ((Y2 - Y1)*(Z3 - Z1) - (Y3 - Y1)*(Z2 - Z1)) +
Y1 * ((X3 - X1)*(Z2 - Z1) - (X2 - X1)*(Z3 - Z1)) +
Z1 * ((X2 - X1)*(Y3 - Y1) - (X3 - X1)*(Y2 - Y1))

Two or More Planes

Intersection of Two Planes

Given two planes A1*X + B1*Y +C1*Z +D1 = 0 and A2*X + B2*Y + C2*Z + D2 = 0 The direction numbers of the line that satisfies both equations are B1*C2-C1*B2, C1*A2-A1*C2, A1*B2-B1*A2 . This line intersects the Z = 0 plane at: X = (D1*B2 - D2*B1)/(A2*B1 - A1*B2) , Y = (D2*A1 - D1*A2)/(A2*B1 - A1*B2) , Z = 0 The equation of the line can therefore be written using the point-slope form or the parametric form.

Intersection of Three Planes

Three planes, given by equations A1*X + B1*Y + C1*Z +D1 =0, A2*X + B2*Y + C2*Z +D2 =0, and A3*X + B3*Y + C3*Z +D3 =0, meet at either a point, a common line, or not at all. Finding the solution amounts to solving three linear equations in three unknowns. Computationally, the easiest way to approach this problem is by determinants. You need to compute:

               |A1  B1  C1|            |D1  B1  C1|         E0 =  |A2  B2  C2|       E1 = |D2  B2  C2|               |A3  B3  C3|            |D3  B3  C3|               |A1  D1  C1|            |A1  B1  D1|         E2 =  |A2  D2  C2|       E3 = |A2  B2  D2|               |A3  D3  C3|            |A3  B3  D3|

The full expressions for E0,E1,E2 and E3 are as follows:

E0 = A1*(B2*C3-B3*C2) + A2*(C1*B3-C3*B1) + A3*(B1*C2-B2*C1)
E1 = D1*(B2*C3-B3*C2) + D2*(C1*B3-C3*B1) + D3*(B1*C2-B2*C1)
E2 = A1*(D2*C3-D3*C2) + A2*(C1*D3-C3*D1) + A3*(D1*C2-D2*C1)
E3 = A1*(B2*D3-B3*D2) + A2*(D1*B3-D3*B1) + A3*(B1*D2-B2*D1)

The common solution of the three equations is given by: X = E1/e0 Y = E2/e0 Z = E3/e0 Note that if E0 = 0 the solution is indeterminate. If any two sets of direction numbers have identical ratios, say: A1 : B1 : C1 = A2 : B2 : C2 , then those two planes are parallel. If this condition does not exist for any pair of planes but E0 is still zero, then all three planes meet in a common line. In writing programs that involve the intersections of several planes, it is usually useful to compute E0 first. If it turns out to be zero there may be no need to perform the other calculations. This method, though well-known, can be astonishingly hard to find in a math text. One major text I know of has no listings at all under simultaneous equations or determinants. It is therefore useful to know the formal names of this method: Cramer's Rule or the Rule of Sarrus.


Return to Course Syllabus
Return to Course Notes Index
Return to Professor Dutch's Home Page

Created 1 April 1999, Last Update 24 May 2020